package Banco;

import Class.User;
import dataBase.conexao;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;

public class Selects {
    public User select_user(String busca) throws SQLException{
        User u = new User();
        Connection c = null;
        conexao connect = new conexao();
        c = connect.getConnection();
        java.sql.Statement stm = c.createStatement();         
        String sql = "SELECT * FROM helpdeskweb.user WHERE ";
        sql += "id = ";
        sql += "'" +(busca)+"'";
        sql += " AND exclusao = ";
        sql += "'" +(0)+"'";
        ResultSet rs = stm.executeQuery(sql);
        if (rs.next()) {
            u.setNome(rs.getString("nome"));
            u.setSenha(rs.getInt("senha"));
            u.setId(rs.getString("id"));
            u.setExclusao(rs.getInt("exclusao"));
        }
        c.close();
        return u;
    }    
}
